<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<html>
	<head>
		<title>游戏桌管理</title>
		<script type="text/javascript">
      function showDiv(id){
        document.getElementById(id).style.display="block";
        document.getElementById('updateDiv').style.display="none";
      }
      function disDiv(id){
        document.getElementById(id).style.display="none";
      }
      function deleteTable(id){
		  	  	 if(confirm('确定要删除吗?'+id)){
					document.all('gameTable.gtno').value=id;
					document.getElementById("dform").submit();
				}
      }
    </script>

	</head>

	<body>
	<div><input type="button" value="新增游戏桌" onclick="showDiv('createDiv')"/></div>
		<table border="1" width="60%">
			<tr align="center">
				<td>
					游戏桌
				</td>
				<td>
					网址
				</td>
				<td>开场时间</td>
				<td>关场时间</td>
				<td>每期投注截止</td>
				<td>每期开奖间隔</td>
				<td>
					状态
				</td>
				<td>
					操作
				</td>
			</tr>
			<s:iterator value="pager.data">
				<tr>
					<td>
						<s:property value="deskName" />
					</td>
					<td>
						<s:property value="website" />
					</td>
					<td><s:property value="openTime" /></td>
					<td><s:property value="closeTime" /></td>
					<td><s:property value="endBettingTimeout" /></td>
					<td><s:property value="drawLotteryInterval" /></td>
					<td>
						<s:property value="status" />
					</td>
					<td>
						&nbsp;&nbsp;
						<a
							href="/newbingo/test/PeriodGame_findHistoryRecord.action?gameTable.gtno=${gtno }">查询历史开奖记录</a>
						<a
							href="/newbingo/test/GameTable_findById.action?gameTable.gtno=${gtno}">修改</a>&nbsp;&nbsp;
						<a
							href="javascript:deleteTable(${gtno })">删除</a>&nbsp;&nbsp;
						<s:if test="status=='running'">
							<a
								href="/newbingo/test/GameTable_updateStatus.action?gameTable.gtno=${gtno }&gameTable.status=closed">关闭</a>
						</s:if>
						&nbsp;&nbsp;
						<s:if test="status=='closed'">
							<a
								href="/newbingo/test/GameTable_updateStatus.action?gameTable.gtno=${gtno }&gameTable.status=running">开启</a>
						</s:if>
					</td>
				</tr>
			</s:iterator>
		</table>
		<form action="/newbingo/test/GameTable_delete.action" name="dform"
			method="post">
			<input type="hidden" name="gameTable.gtno" />
		</form>
		<div id="createDiv" style="display: none;">
			<div>
				新增游戏桌：
			</div>
			<form action="/newbingo/test/GameTable_create.action" method="post">
				<table>
					<tr>
						<td>
							游戏桌名称：
						</td>
						<td>
							<input type="text" name="gameTable.name" />
						</td>
					</tr>
					<tr>
						<td>
							网址：
						</td>
						<td>
							<input type="text" name="gameTable.website" />
						</td>
					</tr>
					<tr>
						<td>
							状态：
						</td>
						<td>
							<SELECT name="gameTable.status">
								<option value="running">
									running
								</option>
								<option value="closed">
									closed
								</option>
								<option value="endBetting">
									endBetting
								</option>
							</SELECT>
						</td>
					</tr>
					<tr>
						<td>
							所属游戏：
						</td>
						<td>
							<input type="text" name="gameTable.game.gameno" value="${game.gameno }"/>
						</td>
					</tr>
				</table>
				<input type="submit" value="提 交" />
				&nbsp;&nbsp;
				<input type="button" onclick="disDiv('createDiv')" value="取 消" />
			</form>
		</div>
	</body>
</html>
